<?php
include "config/config.php";
include "inc/database.php";
include "inc/functions.php";
include "locale/language.php";

$db = new db();

$query = "SELECT
		song.ID,
		song.cover_url as cover,
		song.filename as name
	FROM
		song,artist
	WHERE
		artist.ID = ".$_REQUEST["ID"]."
		AND artist.ID = song.artistID
		AND trim(song.filename) != ''
	GROUP BY song.ID
	ORDER BY song.filename";

$result = $db->query( $query );
echo "<div class='artist_list_template'><div class='album_from_artist'>";
if ( $db->num_rows( $result ) ) {
	while ( $row = $db->fetch_array( $result ) ) {
		echo "
		<div class='coverCotainer'>
			<div onmouseover=\"album_selection_mouse_in(this)\" onmouseout=\"album_selection_mouse_out(this)\" class='album_from_artist_entry' onClick='load_album(".$row["ID"].",this)'>
				<div class='album_cover_row'><img src='".$row["cover"]."s64/'></div>
				<div class='album_name_row'><a href='javascript: void(0)'>".$row["name"]."</a></div>
			</div>
		</div>";
	}
}
else {
	echo "<div class='album_from_artist_nothing'>".lang( "no_albums_found" )."</div>";
}
echo "</div></div>";
?>
